package com.project.service.imp;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.MainForum;
import com.project.bean.PostBean;
import com.project.mapper.IPostMapper;
import com.project.service.IPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
@Service
@Transactional
public class PostServiceImp implements IPostService {
    @Autowired
    private IPostMapper mapper;
    @Override
    public IPage<PostBean> cutByItem(Integer pageNum, Integer id, String title,String name, LocalDate startDate, LocalDate endDate) {
        return mapper.cutByItem(new Page(pageNum,3),id,name,title,startDate,endDate);
    }

    @Override
    public void add(PostBean postBean) {
        mapper.insert(postBean);
    }

    @Override
    public PostBean findById(Integer id) {
        return mapper.findById(id);
    }

}
